class zookeeper (
  #  $myid = $zookeeper::params::myid,
  #  $servers = $zookeeper::params::servers,
  $package_url = http: //www-us.apache.org/dist/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz,
$package_dir = /usr/local/src,
$install_dir = /usr/local/zookeeper,
$basefilename =zookeeper.tar.gz  {

require java

exec { 'create-zk-packagedir':
cwd     => '/',
path    => ['/usr/bin', '/bin'],
command => "mkdir -p ${package_dir}",
creates => $package_dir;
}

file { $package_dir:
  ensure  => 'directory',
  require => Exec['create-zk-packagedir'],
}

exec { 'download-zk-package':
  command => "wget -O ${package_dir}/${basefilename}
    $package_url 2 > /dev/null",
  path    => ['/usr/bin','/bin'],
  create  => "${package_dir}/${basefilename}",
  require => File[$package_dir]
}

exe { "untar ${basefilename}":
  command => "tar zxvf ${package_dir}/${basefilename} -C ${install_dir}",
  require => Exec['download-zk-package'],
  path    => ["/bin","/usr/bin/","/usr/sbin"],
}

}
